#ifndef __STATES_H
#define __STATES_H

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspkdebug.h>
#include <pspsdk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* application state */
#define APP_INITING			0
#define APP_INIT 			1
#define APP_READY			2
#define APP_HUB_READY		3
#define APP_DEV1_WAIT		4
#define APP_TERM			100

#define USB_BASE_ADDRESS 0xBD800000
#define USB_SIZE_ADDRESS 0x00000100

#define k1s k1 = pspSdkSetK1(0)
#define k1r pspSdkSetK1(k1)

/* Estructuras */
struct hp {
		u16 status;
		u16 change;
};

struct ds {
	int regged;
	int loaded;
	int started;
};

struct passingdata {
	char text[6144];
	void* p;
	unsigned int timeout;
	unsigned int status;
	struct hp ports[8];
	struct ds *hubstatus;
	unsigned int connected;
};


extern int estado;
extern u32 k1;
extern struct hp localports[8];
extern struct ds localhubstatus;
extern int dumpoffset;

/* Variables */
extern struct passingdata *pdata;
extern struct passingdata res;


/* Funciones */
void resetdata(struct passingdata *res);
void memdumper(char *filename);

/* log */
#ifndef LOADER
void loginit();
void logecho(char *msg);
#endif

#endif


